package com.itheima.d6_object_stream;

import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList;

/*
  目标：掌握对象字节输入流的使用：反序列化对象。
 */
public class Test2ObjectInputStream {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("object.txt");
        ObjectInputStream ois = new ObjectInputStream(fis);

//        User o = (User) ois.readObject();
//        System.out.println(o.getName() + ":" + o.getZi());
        ArrayList<User> list = (ArrayList<User>) ois.readObject();
        for (User user : list) {
            System.out.println(user.getName() + ":" + user.getSkill() + ":" + user.getAge()+ user.getZi());
        }
        ois.close();
    }
}
